#include "leak_test_thread.h"
#include "main.h"


leak_test_thread::leak_test_thread(QObject *parent) :
    QThread(parent)
{  sterilizing=0;
}

void leak_test_thread::run()
 {
    int t1=300;
    int t2=600;
   warn warnning;
    sterilizing=1;
    Vacuum_pump_ON;
    state=0;
 loop1:
 while(PSU>-93){ msleep(500);}
    msleep(1000);
 if(PSU>-93) { goto loop1;}
 pressure[0]=PSU;

    Vacuum_pump_OFF;
    timer_working=0;
    state=1;
    while(t1--)
    {
    msleep(1000);
    }
    pressure[1]=PSU;
    timer_working=0;
    state=2;
    while(t2--)
    {
    msleep(1000);
    }
    pressure[2]=PSU;


    if(pressure[2]-pressure[1]<=2)
    {
        warnning.ui->label->setText(QString::fromUtf8("本次测试合格！"));
    }
    else
    {
        warnning.ui->label->setText(QString::fromUtf8("本次测试不合格！"));
    }
       warnning.show();
        sterilizing=0;

  }
